import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class PropertiesTest {
    public static void main(String[] args) {
        InputStream is = null;
        Properties properties = new Properties();
        try {
            is = PropertiesTest.class.getClassLoader().getResourceAsStream("info.properties");
            try {
                properties.load(is);
                String className = properties.getProperty("className");
                String methodName = properties.getProperty("methodName");
                Class<?> cls = Class.forName(className);
                System.out.println(cls);
                Object o = cls.newInstance();
                System.out.println(o);
                Method method = cls.getMethod(methodName);
                Object invoke = method.invoke(o);
                System.out.println(invoke);


            } catch (IOException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }


        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
